<table class="print table table-bordered table-striped">
    <thead>
        <tr >
            <th rowspan="2">No</th>
            <th rowspan="2">Kode</th>
            <th rowspan="2">Nama Proyek</th>
            <th rowspan="2">Nama PM</th>
            <th colspan="2">ADD</th>
            <th colspan="3">Waktu Pelaksanaan</th>
        </tr>
        <tr >
            <th>NK <br /> Akhir</th>
            <th>NK-PPN <br /> Akhir</th>
            <th>TGL <br /> Mulai</th>
            <th>TGL <br /> P1</th>
            <th>TGL <br /> P2</th>
        </tr>
    </thead>
    <tbody>
        
<?php
    $i = 0;
    $cabang = "";
    foreach($data as $row){
        $i ++;
        // header cabang
        if ($cabang != $row->cabang_nama){
            $cabang = $row->cabang_nama;
            echo "
                <tr>
                    <th colspan=9>&nbsp;</th>
                </tr>
                <tr>
                    <th colspan=9>$cabang</th>
                </tr>
            ";
        }
            
        
        // record 
        echo "
        <tr>
            <td>$i</td>
            <td>$row->proyek_kode</td>
            <td>$row->proyek_nama</td>
            <td>$row->proyek_pm</td>
            <td style='text-align:right' >Rp. ".number_format($row->proyek_nk,0,",",".")."</td>
            <td style='text-align:right' >Rp. ".number_format($row->proyek_nkppn,0,",",".")."</td>
            <td>".dateIndonesiaNoDay($row->proyek_mulai)."</td>
            <td>".dateIndonesiaNoDay($row->proyek_p1)."</td>
            <td>".dateIndonesiaNoDay($row->proyek_p2)."</td>
        </tr>
        ";
    }
?>
    </tbody>
</table>

        
